{{ include './header.html'}}

<body>
  <div id="wrap">
    {{ include './left.html'}}
    <!-- 右侧具体内容栏目 -->
    <div id="rightContent">
      <div id="personInfor" style="text-align: right; background-color:blanchedalmond;">
        <p id="userName">
          <a> 用户:{{adminname}} </a>
          <a href="/admin/login/loginout">退出</a>
        </p>
      </div>

      <!--管理员管理模块-->
      <div role="tabpanel" class="tab-pane" id="admin">
        <div class="check-div form-inline">
          <div class="col-xs-5">
            <button class="btn btn-yellow btn-xs" data-toggle="modal" data-target="#addPrint">添加管理员
            </button>
        </div>
          <div class="col-xs-4">
            <input type="text" class="form-control input-sm" placeholder="输入文字搜索">
            <button class="btn btn-white btn-xs ">查 询 </button>
          </div>
        </div>
        <div class="data-div">
          <div class="row tableHeader">
            <div class="col-xs-3 ">
              编号
            </div>
            <div class="col-xs-3 ">
              id
            </div>
            <div class="col-xs-3 ">
              name
            </div>
            <div class="col-xs-3">
              操作
            </div>
          </div>

          <div class="tablebody">
            <% for(var i=0; i<adminlist.length; i++) {%>
              <div class="row">
                <div class="col-xs-3 ">
                  <%= adminlist[i].rowid %>
                </div>
                <div class="col-xs-3 ">
                  <%= adminlist[i].adminId %>
                </div>
                <div class="col-xs-3">
                  <%= adminlist[i].name %>
                </div>
                <div class="col-xs-3">
                  <button class="btn btn-success btn-xs" data-toggle="modal" data-target="#reviseAdmin"
                    onclick="editAdminInfo({{adminlist[i]}})">修改</button>
                  <button class="btn btn-danger btn-xs" data-toggle="modal" data-target="#deleteAdmin"
                    onclick="deleteAdmin({{adminlist[i]}})">删除</button>
                </div>

              </div>
              <% } %>

          </div>
          <div class="pagination" id="pagination4" style="float: right; background-color: cornflowerblue; "></div>

        </div>
        <!--页码块-->
        <script type="text/javascript" src="../../js/jqPaginator.js"></script>
        <script>
          $('#pagination4').jqPaginator({
            totalPages: {{ admintotalPages }},
            visiblePages: 8,
            currentPage: {{ currentPage }},
            onPageChange: function (num, type) {
              console.log(num, type)
              if (type == 'change') {
                location.href = "/admin/index/adminnextpage?page=" + num
              }
            }
    })

        </script>

        <script>
          function editAdminInfo(obj) {
            // //向模态框中传值
            $('#adminId').val(obj.adminId);
            $('#name').val(obj.name);
            $('#password').val(obj.password);
            // $('#printName').val(obj.printName);
            // $('#Brand').val(obj.brand);
            // $('#model').val(obj.model);
            // $('#update').modal('show');
          }

          function deleteAdmin(obj) {
            // console.log(obj)
            $('#adminId1').val(obj.adminId);
          }
        </script>

        <!--弹出添加管理员窗口-->
        <div class="modal fade" id="addPrint" role="dialog" aria-labelledby="gridSystemModalLabel">
          <div class="modal-dialog" role="document">
            <div class="modal-content">
              <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                    aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="gridSystemModalLabel">添加管理员</h4>
              </div>
              <div class="modal-body">
                <div class="container-fluid">
                  <form class="form-horizontal" action="/admin/index/addAdmin" method="POST">
                    <div class="form-group ">
                      <label for="sName" class="col-xs-4 control-label">管理员id：</label>
                      <div class="col-xs-8 ">
                        <input type="text" class="form-control input-sm duiqi" name="adminId" placeholder=" ">
                      </div>
                    </div>

                    <div class="form-group ">
                      <label for="sName" class="col-xs-4 control-label">管理员姓名：</label>
                      <div class="col-xs-8 ">
                        <input type="text" class="form-control input-sm duiqi" name="name" placeholder=" ">
                      </div>
                    </div>

                    <div class="form-group ">
                      <label for="sName" class="col-xs-4 control-label">密码：</label>
                      <div class="col-xs-8 ">
                        <input type="password" class="form-control input-sm duiqi" name="password" placeholder="" required>
                      </div>
                    </div>

                    <div class="modal-footer">
                      <button type="button" class="btn btn-xs btn-white" data-dismiss="modal">取 消</button>
                      <button type="submit" class="btn btn-xs btn-green">保 存</button>
                    </div>
                  </form>

                </div>
              </div>

            </div>
            <!-- /.modal-content -->
          </div>
          <!-- /.modal-dialog -->
        </div>
        <!-- /.modal -->

        <!--弹出修改管理员窗口-->
        <div class="modal fade" id="reviseAdmin" role="dialog" aria-labelledby="gridSystemModalLabel">
          <div class="modal-dialog" role="document">
            <div class="modal-content">
              <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                    aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="gridSystemModalLabel">修改管理员</h4>
              </div>
              <div class="modal-body">
                <div class="container-fluid">
                  <form class="form-horizontal" action="/admin/index/updateAdmin" method="POST">
                    <div class="form-group ">
                      <label for="sName" class="col-xs-3 control-label">管理员id：</label>
                      <div class="col-xs-8 ">
                        <input type="text" class="form-control input-sm duiqi" name="adminId" id="adminId" readonly >
                      </div>
                    </div>

                    <div class="form-group ">
                      <label for="sName" class="col-xs-3 control-label">管理员姓名：</label>
                      <div class="col-xs-8 ">
                        <input type="text" class="form-control input-sm duiqi" name="name" id="name" placeholder=" ">
                      </div>
                    </div>

                    <div class="form-group ">
                      <label for="sName" class="col-xs-3 control-label">管理员密码：</label>
                      <div class="col-xs-8 ">
                        <input type="password" class="form-control input-sm duiqi" name="password" id="password" placeholder="密码" required>
                      </div>
                    </div>

                    <div class="modal-footer">
                      <button type="button" class="btn btn-xs btn-white" data-dismiss="modal">取 消</button>
                      <button type="submit" class="btn btn-xs btn-green">保 存</button>
                    </div>
                  </form>
                </div>
              </div>

            </div>
            <!-- /.modal-content -->
          </div>
          <!-- /.modal-dialog -->
        </div>
        <!-- /.modal -->

        <!--弹出删除管理员警告窗口-->
        <div class="modal fade" id="deleteAdmin" role="dialog" aria-labelledby="gridSystemModalLabel">
          <div class="modal-dialog" role="document">
            <div class="modal-content">
              <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                    aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="gridSystemModalLabel">提示</h4>
              </div>
              <div class="modal-body">
                <div class="container-fluid">
                  <form class="form-horizontal" action="/admin/index/deleteAdmin" method="POST">
                    确定要删除该管理员？删除后不可恢复！
                    <div class="form-group ">
                      <label for="sName" class="col-xs-3 control-label">AdminId：</label>
                      <div class="col-xs-8 ">
                        <input type="text" class="form-control input-sm duiqi" name="adminId" id="adminId1" readonly>
                      </div>
                    </div>
                    <div class="modal-footer">
                      <button type="button" class="btn btn-xs btn-white" data-dismiss="modal">取 消</button>
                      <button type="submit" class="btn  btn-xs btn-danger">确定</button>
                    </div>
                  </form>
                </div>
              </div>

            </div>
            <!-- /.modal-content -->
          </div>
          <!-- /.modal-dialog -->
        </div>
        <!-- /.modal -->
      </div>
    </div>
  </div>

</body>

</html>